package com.oocl.scan.store;

import com.oocl.scan.model.Constant;
import java.util.LinkedList;

public class ConstantStore  implements Store<Constant> {

  private LinkedList<Constant> constantsQueue;

  private static ConstantStore componentStore;

  public ConstantStore() {
    this.constantsQueue = new LinkedList<>();
  }

  public static ConstantStore getInstance() {
    if (componentStore == null) {
      synchronized (ConstantStore.class) {
        if (componentStore == null) {
          componentStore = new ConstantStore();
        }
      }
    }
    return componentStore;
  }

  public LinkedList<Constant> getComponentQueue() {
    return constantsQueue;
  }

  public void add(Constant constant) {
    this.constantsQueue.add(constant);
  }


  public int getCount() {
    return this.constantsQueue.size();
  }

  @Override
  public Constant poll() {
    return this.constantsQueue.poll();
  }
}
